org.newsml.toolkit
Interface NewsMLFactory

All Known Implementing Classes:
DOMNewsMLFactory

public interface NewsMLFactory

Factory interface for NewsML documents.

This is an abstract factory interface for creating NewsML documents and nodes from external resources: it contains methods that can create a top-level NewsML object or any arbitrary NewsML node (implementing the BaseNode interface) given a URL or a character stream. Normally, this will be the only public point of access to subpackages that contain contain concrete implementations, such as DOMNewsMLFactory.

HINT: a Java Reader can read from any source, not just a file. For example, if you need to read NewsML document from a string, try using a StringReader; if you need to parse data coming from somewhere else in your program, try a PipedReader.

This class includes setValidation(boolean) and getValidation() methods for enabling or disabling DTD validation. If the validation property is true, the factory will process the XML source with DTD-validation or throw an exception if the underlying implementation does not support validation; if it is false, the factory will process the XML source without DTD-validation or throw an exception if the underlying implementation does not support non-validating parsing. The default value is system-dependent, but will usually be false for reasons explained below.

If validation is false (recommended), the implementation will not load any external XML entities, including the external DTD subset, and will not report validation errors; if validation is true (dangerous: see below), the implementation will attempt to load all externally-referenced XML entities, and will fail with an exception if there are any validation errors.

While DTD-validation is frequently promoted in XML books and workshops, it is almost always a bad idea for production applications: it has the potential to cause serious problems and should be used only with extreme caution (or better yet, not at all). DTD validation opens your applications and your organization to the following serious risks:

  1. Performance degradation: a DTD hosted at a remote site could take seconds or minutes to load because of network congestion or a heavy load on the host: for a system processing thousands of NewsML packages daily, the delays may be fatal.
  2. Denial of service: if system hosting the DTD is down, or if the system administrator changes the location of the DTD file, your system will be unable to process any NewsML packages. Malicious parties may crack the system hosting the DTD and make subtle (and difficult to find changes) that cause all of your NewsML packages to be rejected, or the DTD may be legitimately upgraded to a newer version with the same effect. In essence, the security of your whole system is no better than the security of the external computer hosting the DTD.
  3. Sabotage: in addition to modifying the DTD to force your NewsML documents to be rejected, a malicious user could modify the DTD to change default values for attributes, causing your system to process the NewsML packages correctly but produce incorrect output and mis-categorization.
  4. Unintentional disclosure: since a DTD-validating system hits the external host every time it processes a NewsML package, the external host can do traffic analysis to learn about how your internal system works.

Version:
2.0
Author:
Reuters PLC
See Also:
NewsMLException

Method Summary
 AdministrativeMetadata createAdministrativeMetadata()
          Create a new, empty AdministrativeMetadata element.
 AdministrativeMetadata createAdministrativeMetadata(AdministrativeMetadata node)
          Copy an existing AdministrativeMetadata element.
 Text createAllowedValuesAttr()
          Create a new, empty AllowedValues attribute.
 Text createAllowedValuesAttr(Text node)
          Copy an existing AllowedValues attribute.
 Text createAssignedByAttr()
          Create a new, empty AssignedBy attribute.
 Text createAssignedByAttr(Text node)
          Copy an existing AssignedBy attribute.
 NewsItemRef createAssociatedWith()
          Create a new, empty AssociatedWith element.
 NewsItemRef createAssociatedWith(NewsItemRef node)
          Copy an existing AssociatedWith element.
 BasisForChoice createBasisForChoice()
          Create a new, empty BasisForChoice element.
 BasisForChoice createBasisForChoice(BasisForChoice node)
          Copy an existing BasisForChoice element.
 OriginText createByLine()
          Create a new, empty ByLine element.
 OriginText createByLine(OriginText node)
          Copy an existing ByLine element.
 Catalog createCatalog()
          Create a new, empty Catalog element.
 Catalog createCatalog(Catalog node)
          Copy an existing Catalog element.
 Characteristics createCharacteristics()
          Create a new, empty Characteristics element.
 Characteristics createCharacteristics(Characteristics node)
          Copy an existing Characteristics element.
 Comment createComment()
          Create a new, empty Comment element.
 Comment createComment(Comment node)
          Copy an existing Comment element.
 Text createConfidenceAttr()
          Create a new, empty Confidence attribute.
 Text createConfidenceAttr(Text node)
          Copy an existing Confidence attribute.
 ContentItem createContentItem()
          Create a new, empty ContentItem element.
 ContentItem createContentItem(ContentItem node)
          Copy an existing ContentItem element.
 Text createContextAttr()
          Create a new, empty Context attribute.
 Text createContextAttr(Text node)
          Copy an existing Context attribute.
 PartyList createContributor()
          Create a new, empty Contributor element.
 PartyList createContributor(PartyList node)
          Copy an existing Contributor element.
 Copyright createCopyright()
          Create a new, empty Copyright element.
 Copyright createCopyright(Copyright node)
          Copy an existing Copyright element.
 OriginText createCopyrightDate()
          Create a new, empty CopyrightDate element.
 OriginText createCopyrightDate(OriginText node)
          Copy an existing CopyrightDate element.
 OriginText createCopyrightHolder()
          Create a new, empty CopyrightHolder element.
 OriginText createCopyrightHolder(OriginText node)
          Copy an existing CopyrightHolder element.
 OriginText createCopyrightLine()
          Create a new, empty CopyrightLine element.
 OriginText createCopyrightLine(OriginText node)
          Copy an existing CopyrightLine element.
 PartyList createCreator()
          Create a new, empty Creator element.
 PartyList createCreator(PartyList node)
          Copy an existing Creator element.
 OriginText createCreditLine()
          Create a new, empty CreditLine element.
 OriginText createCreditLine(OriginText node)
          Copy an existing CreditLine element.
 DataContent createDataContent()
          Create a new, empty DataContent element.
 DataContent createDataContent(DataContent node)
          Copy an existing DataContent element.
 IdText createDateAndTime()
          Create a new, empty DateAndTime element.
 IdText createDateAndTime(IdText node)
          Copy an existing DateAndTime element.
 Text createDateAndTimeAttr()
          Create a new, empty DateAndTime attribute.
 Text createDateAndTimeAttr(Text node)
          Copy an existing DateAndTime attribute.
 Text createDateId()
          Create a new, empty DateId element.
 Text createDateId(Text node)
          Copy an existing DateId element.
 IdText createDateLabel()
          Create a new, empty DateLabel element.
 IdText createDateLabel(IdText node)
          Copy an existing DateLabel element.
 OriginText createDateLine()
          Create a new, empty DateLine element.
 OriginText createDateLine(OriginText node)
          Copy an existing DateLine element.
 DefaultVocabularyFor createDefaultVocabularyFor()
          Create a new, empty DefaultVocabularyFor element.
 DefaultVocabularyFor createDefaultVocabularyFor(DefaultVocabularyFor node)
          Copy an existing DefaultVocabularyFor element.
 Delta createDelete()
          Create a new, empty Delete element.
 Delta createDelete(Delta node)
          Copy an existing Delete element.
 NewsItemRef createDerivedFrom()
          Create a new, empty DerivedFrom element.
 NewsItemRef createDerivedFrom(NewsItemRef node)
          Copy an existing DerivedFrom element.
 Description createDescription()
          Create a new, empty Description element.
 Description createDescription(Description node)
          Copy an existing Description element.
 DescriptiveMetadata createDescriptiveMetadata()
          Create a new, empty DescriptiveMetadata element.
 DescriptiveMetadata createDescriptiveMetadata(DescriptiveMetadata node)
          Copy an existing DescriptiveMetadata element.
 Text createDetailsAttr()
          Create a new, empty Details attribute.
 Text createDetailsAttr(Text node)
          Copy an existing Details attribute.
 Text createDuidAttr()
          Create a new, empty Duid attribute.
 Text createDuidAttr(Text node)
          Copy an existing Duid attribute.
 Text createDuidRefAttr()
          Create a new, empty DuidRef attribute.
 Text createDuidRefAttr(Text node)
          Copy an existing DuidRef attribute.
 Encoding createEncoding()
          Create a new, empty Encoding element.
 Encoding createEncoding(Encoding node)
          Copy an existing Encoding element.
 AssignedOriginText createEndDate()
          Create a new, empty EndDate element.
 AssignedOriginText createEndDate(AssignedOriginText node)
          Copy an existing EndDate element.
 Text createEquivalentsListAttr()
          Create a new, empty EquivalentsList attribute.
 Text createEquivalentsListAttr(Text node)
          Copy an existing EquivalentsList attribute.
 Text createEssentialAttr()
          Create a new, empty Essential attribute.
 Text createEssentialAttr(Text node)
          Copy an existing Essential attribute.
 Text createEuidAttr()
          Create a new, empty Euid attribute.
 Text createEuidAttr(Text node)
          Copy an existing Euid attribute.
 IdText createFileName()
          Create a new, empty FileName element.
 IdText createFileName(IdText node)
          Copy an existing FileName element.
 IdText createFirstCreated()
          Create a new, empty FirstCreated element.
 IdText createFirstCreated(IdText node)
          Copy an existing FirstCreated element.
 FormalNameDecl createFormalName()
          Create a new, empty FormalName element.
 FormalNameDecl createFormalName(FormalNameDecl node)
          Copy an existing FormalName element.
 Text createFormalNameAttr()
          Create a new, empty FormalName attribute.
 Text createFormalNameAttr(Text node)
          Copy an existing FormalName attribute.
 FormalName createFormat()
          Create a new, empty Format element.
 FormalName createFormat(FormalName node)
          Copy an existing Format element.
 FormalName createFutureStatus()
          Create a new, empty FutureStatus element.
 FormalName createFutureStatus(FormalName node)
          Copy an existing FutureStatus element.
 AssignedFormalName createGenre()
          Create a new, empty Genre element.
 AssignedFormalName createGenre(AssignedFormalName node)
          Copy an existing Genre element.
 AssignedOriginText createGeography()
          Create a new, empty Geography element.
 AssignedOriginText createGeography(AssignedOriginText node)
          Copy an existing Geography element.
 OriginText createHeadLine()
          Create a new, empty HeadLine element.
 OriginText createHeadLine(OriginText node)
          Copy an existing HeadLine element.
 Text createHowPresentAttr()
          Create a new, empty HowPresent attribute.
 Text createHowPresentAttr(Text node)
          Copy an existing HowPresent attribute.
 Text createHrefAttr()
          Create a new, empty Href attribute.
 Text createHrefAttr(Text node)
          Copy an existing Href attribute.
 Identification createIdentification()
          Create a new, empty Identification element.
 Identification createIdentification(Identification node)
          Copy an existing Identification element.
 Text createImportanceAttr()
          Create a new, empty Importance attribute.
 Text createImportanceAttr(Text node)
          Copy an existing Importance attribute.
 Delta createInsertAfter()
          Create a new, empty InsertAfter element.
 Delta createInsertAfter(Delta node)
          Copy an existing InsertAfter element.
 Delta createInsertBefore()
          Create a new, empty InsertBefore element.
 Delta createInsertBefore(Delta node)
          Copy an existing InsertBefore element.
 Instruction createInstruction()
          Create a new, empty Instruction element.
 Instruction createInstruction(Instruction node)
          Copy an existing Instruction element.
 OriginText createKeywordLine()
          Create a new, empty KeywordLine element.
 OriginText createKeywordLine(OriginText node)
          Copy an existing KeywordLine element.
 Label createLabel()
          Create a new, empty Label element.
 Label createLabel(Label node)
          Copy an existing Label element.
 IdText createLabelText()
          Create a new, empty LabelText element.
 IdText createLabelText(IdText node)
          Copy an existing LabelText element.
 FormalName createLabelType()
          Create a new, empty LabelType element.
 FormalName createLabelType(FormalName node)
          Copy an existing LabelType element.
 AssignedFormalName createLanguage()
          Create a new, empty Language element.
 AssignedFormalName createLanguage(AssignedFormalName node)
          Copy an existing Language element.
 AssignedOriginText createLimitations()
          Create a new, empty Limitations element.
 AssignedOriginText createLimitations(AssignedOriginText node)
          Copy an existing Limitations element.
 FormalName createMediaType()
          Create a new, empty MediaType element.
 FormalName createMediaType(FormalName node)
          Copy an existing MediaType element.
 Metadata createMetadata()
          Create a new, empty Metadata element.
 Metadata createMetadata(Metadata node)
          Copy an existing Metadata element.
 FormalName createMetadataType()
          Create a new, empty MetadataType element.
 FormalName createMetadataType(FormalName node)
          Copy an existing MetadataType element.
 FormalName createMimeType()
          Create a new, empty MimeType element.
 FormalName createMimeType(FormalName node)
          Copy an existing MimeType element.
 IdText createNameLabel()
          Create a new, empty NameLabel element.
 IdText createNameLabel(IdText node)
          Copy an existing NameLabel element.
 BaseNode createNewNode(BaseNode node)
          Copy an existing NewsML element node.
 BaseNode createNewNode(String name)
          Create a new, empty NewsML element node.
 Text createNewNodeAttr(String name)
          Create a new, empty NewsML attribute node.
 Text createNewNodeAttr(Text node)
          Copy an existing NewsML attribute node.
 NewsComponent createNewsComponent()
          Create a new, empty NewsComponent element.
 NewsComponent createNewsComponent(NewsComponent node)
          Copy an existing NewsComponent element.
 NewsEnvelope createNewsEnvelope()
          Create a new, empty NewsEnvelope element.
 NewsEnvelope createNewsEnvelope(NewsEnvelope node)
          Copy an existing NewsEnvelope element.
 NewsIdentifier createNewsIdentifier()
          Create a new, empty NewsIdentifier element.
 NewsIdentifier createNewsIdentifier(NewsIdentifier node)
          Copy an existing NewsIdentifier element.
 NewsItem createNewsItem()
          Create a new, empty NewsItem element.
 NewsItem createNewsItem(NewsItem node)
          Copy an existing NewsItem element.
 Text createNewsItemAttr()
          Create a new, empty NewsItem attribute.
 Text createNewsItemAttr(Text node)
          Copy an existing NewsItem attribute.
 NewsItemId createNewsItemId()
          Create a new, empty NewsItemId element.
 NewsItemId createNewsItemId(NewsItemId node)
          Copy an existing NewsItemId element.
 NewsItemRef createNewsItemRef()
          Create a new, empty NewsItemRef element.
 NewsItemRef createNewsItemRef(NewsItemRef node)
          Copy an existing NewsItemRef element.
 FormalName createNewsItemType()
          Create a new, empty NewsItemType element.
 FormalName createNewsItemType(FormalName node)
          Copy an existing NewsItemType element.
 NewsLine createNewsLine()
          Create a new, empty NewsLine element.
 NewsLine createNewsLine(NewsLine node)
          Copy an existing NewsLine element.
 NewsLines createNewsLines()
          Create a new, empty NewsLines element.
 NewsLines createNewsLines(NewsLines node)
          Copy an existing NewsLines element.
 OriginText createNewsLineText()
          Create a new, empty NewsLineText element.
 OriginText createNewsLineText(OriginText node)
          Copy an existing NewsLineText element.
 FormalName createNewsLineType()
          Create a new, empty NewsLineType element.
 FormalName createNewsLineType(FormalName node)
          Copy an existing NewsLineType element.
 NewsManagement createNewsManagement()
          Create a new, empty NewsManagement element.
 NewsManagement createNewsManagement(NewsManagement node)
          Copy an existing NewsManagement element.
 NewsML createNewsML()
          Create a new, empty NewsML element.
 NewsML createNewsML(NewsML node)
          Copy an existing NewsML element.
 NewsML createNewsML(Reader input, String baseURL)
          Create a top-level NewsML object from a character stream.
 NewsML createNewsML(String url)
          Create a top-level NewsML object from a URL.
 FormalName createNewsProduct()
          Create a new, empty NewsProduct element.
 FormalName createNewsProduct(FormalName node)
          Copy an existing NewsProduct element.
 FormalName createNewsService()
          Create a new, empty NewsService element.
 FormalName createNewsService(FormalName node)
          Copy an existing NewsService element.
 BaseNode createNode(Reader input, String baseURL)
          Create a NewsML node from a URL.
 BaseNode createNode(String url)
          Create a NewsML node from a URL.
 FormalName createNotation()
          Create a new, empty Notation element.
 FormalName createNotation(FormalName node)
          Copy an existing Notation element.
 Text createNotationAttr()
          Create a new, empty Notation attribute.
 Text createNotationAttr(Text node)
          Copy an existing Notation attribute.
 OfInterestTo createOfInterestTo()
          Create a new, empty OfInterestTo element.
 OfInterestTo createOfInterestTo(OfInterestTo node)
          Copy an existing OfInterestTo element.
 Origin createOrigin()
          Create a new, empty Origin element.
 Origin createOrigin(Origin node)
          Copy an existing Origin element.
 Party createParty()
          Create a new, empty Party element.
 Party createParty(Party node)
          Copy an existing Party element.
 Text createPreviousRevisionAttr()
          Create a new, empty PreviousRevision attribute.
 Text createPreviousRevisionAttr(Text node)
          Copy an existing PreviousRevision attribute.
 FormalName createPriority()
          Create a new, empty Priority element.
 FormalName createPriority(FormalName node)
          Copy an existing Priority element.
 Property createProperty()
          Create a new, empty Property element.
 Property createProperty(Property node)
          Copy an existing Property element.
 PartyList createProvider()
          Create a new, empty Provider element.
 PartyList createProvider(PartyList node)
          Copy an existing Provider element.
 ProviderId createProviderId()
          Create a new, empty ProviderId element.
 ProviderId createProviderId(ProviderId node)
          Copy an existing ProviderId element.
 Text createPublicIdentifier()
          Create a new, empty PublicIdentifier element.
 Text createPublicIdentifier(Text node)
          Copy an existing PublicIdentifier element.
 Text createRankAttr()
          Create a new, empty Rank attribute.
 Text createRankAttr(Text node)
          Copy an existing Rank attribute.
 AssignedFormalName createRelevance()
          Create a new, empty Relevance element.
 AssignedFormalName createRelevance(AssignedFormalName node)
          Copy an existing Relevance element.
 Text createRepeatAttr()
          Create a new, empty Repeat attribute.
 Text createRepeatAttr(Text node)
          Copy an existing Repeat attribute.
 Delta createReplace()
          Create a new, empty Replace element.
 Delta createReplace(Delta node)
          Copy an existing Replace element.
 Resource createResource()
          Create a new, empty Resource element.
 Resource createResource(Resource node)
          Copy an existing Resource element.
 Text createRevisionAttr()
          Create a new, empty Revision attribute.
 Text createRevisionAttr(Text node)
          Copy an existing Revision attribute.
 RevisionHistory createRevisionHistory()
          Create a new, empty RevisionHistory element.
 RevisionHistory createRevisionHistory(RevisionHistory node)
          Copy an existing RevisionHistory element.
 RevisionId createRevisionId()
          Create a new, empty RevisionId element.
 RevisionId createRevisionId(RevisionId node)
          Copy an existing RevisionId element.
 RevisionStatus createRevisionStatus()
          Create a new, empty RevisionStatus element.
 RevisionStatus createRevisionStatus(RevisionStatus node)
          Copy an existing RevisionStatus element.
 AssignedOriginText createRightsHolder()
          Create a new, empty RightsHolder element.
 AssignedOriginText createRightsHolder(AssignedOriginText node)
          Copy an existing RightsHolder element.
 OriginText createRightsLine()
          Create a new, empty RightsLine element.
 OriginText createRightsLine(OriginText node)
          Copy an existing RightsLine element.
 RightsMetadata createRightsMetadata()
          Create a new, empty RightsMetadata element.
 RightsMetadata createRightsMetadata(RightsMetadata node)
          Copy an existing RightsMetadata element.
 FormalName createRole()
          Create a new, empty Role element.
 FormalName createRole(FormalName node)
          Copy an existing Role element.
 Text createSchemeAttr()
          Create a new, empty Scheme attribute.
 Text createSchemeAttr(Text node)
          Copy an existing Scheme attribute.
 PartyList createSentFrom()
          Create a new, empty SentFrom element.
 PartyList createSentFrom(PartyList node)
          Copy an existing SentFrom element.
 PartyList createSentTo()
          Create a new, empty SentTo element.
 PartyList createSentTo(PartyList node)
          Copy an existing SentTo element.
 OriginText createSeriesLine()
          Create a new, empty SeriesLine element.
 OriginText createSeriesLine(OriginText node)
          Copy an existing SeriesLine element.
 IdText createSizeInBytes()
          Create a new, empty SizeInBytes element.
 IdText createSizeInBytes(IdText node)
          Copy an existing SizeInBytes element.
 OriginText createSlugLine()
          Create a new, empty SlugLine element.
 OriginText createSlugLine(OriginText node)
          Copy an existing SlugLine element.
 SourceList createSource()
          Create a new, empty Source element.
 SourceList createSource(SourceList node)
          Copy an existing Source element.
 AssignedOriginText createStartDate()
          Create a new, empty StartDate element.
 AssignedOriginText createStartDate(AssignedOriginText node)
          Copy an existing StartDate element.
 FormalName createStatus()
          Create a new, empty Status element.
 FormalName createStatus(FormalName node)
          Copy an existing Status element.
 StatusWillChange createStatusWillChange()
          Create a new, empty StatusWillChange element.
 StatusWillChange createStatusWillChange(StatusWillChange node)
          Copy an existing StatusWillChange element.
 OriginText createSubHeadLine()
          Create a new, empty SubHeadLine element.
 OriginText createSubHeadLine(OriginText node)
          Copy an existing SubHeadLine element.
 AssignedFormalName createSubject()
          Create a new, empty Subject element.
 AssignedFormalName createSubject(AssignedFormalName node)
          Copy an existing Subject element.
 SubjectCode createSubjectCode()
          Create a new, empty SubjectCode element.
 SubjectCode createSubjectCode(SubjectCode node)
          Copy an existing SubjectCode element.
 AssignedFormalName createSubjectDetail()
          Create a new, empty SubjectDetail element.
 AssignedFormalName createSubjectDetail(AssignedFormalName node)
          Copy an existing SubjectDetail element.
 AssignedFormalName createSubjectMatter()
          Create a new, empty SubjectMatter element.
 AssignedFormalName createSubjectMatter(AssignedFormalName node)
          Copy an existing SubjectMatter element.