1 23 24 package org.enhydra.xml.xmlc.metadata; 25 26 import org.w3c.dom.Document ; 27 28 30 33 public class Parser extends MetaDataElement { 34 37 public static final String TAG_NAME = "parser"; 38 39 42 private static final String NAME_ATTR = "name"; 43 private static final String VALIDATE_ATTR = "validate"; 44 private static final String WARNINGS_ATTR = "warnings"; 45 46 49 public Parser(Document ownerDoc) { 50 super(ownerDoc, TAG_NAME); 51 } 52 53 56 public XCatalog[] getXCatalog() { 57 return (XCatalog[])getChildren(XCatalog.class); 58 } 59 60 63 public void addXCatalog(XCatalog xCatalog) { 64 appendChild(xCatalog); 65 } 66 67 70 public XCatalog addXCatalog() { 71 XCatalog xCatalog = new XCatalog(getOwnerDocument()); 72 appendChild(xCatalog); 73 return xCatalog; 74 } 75 76 79 public void deleteXCatalog(XCatalog xCatalog) { 80 removeChild(xCatalog); 81 } 82 83 86 public String [] getXCatalogURLs() { 87 XCatalog[] xCatalogs = getXCatalog(); 88 String [] urls = new String [xCatalogs.length]; 89 for (int idx = 0; idx < xCatalogs.length; idx++) { 90 urls[idx] = xCatalogs[idx].getUrl(); 91 } 92 return urls; 93 } 94 95 98 public ParserType getName() { 99 return ParserType.getType(getAttributeNull(NAME_ATTR)); 100 } 101 102 105 public void setName(ParserType value) { 106 if (value == null) { 107 removeAttribute(NAME_ATTR); 108 } else { 109 setAttribute(NAME_ATTR, value.getName()); 110 } 111 } 112 113 116 public Boolean getValidate() { 117 return getBooleanObjectAttribute(VALIDATE_ATTR); 118 } 119 120 124 public void setValidate(Boolean validate) { 125 setBooleanObjectAttribute(VALIDATE_ATTR, validate); 126 } 127 128 131 public void setValidate(boolean validate) { 132 setBooleanAttribute(VALIDATE_ATTR, validate); 133 } 134 135 138 public boolean getWarnings() { 139 return getBooleanAttribute(WARNINGS_ATTR, true); 140 } 141 142 145 public void setWarnings(boolean warnings) { 146 setBooleanAttribute(WARNINGS_ATTR, warnings, true); 147 } 148 } 149 | Popular Tags |