http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Charter
Release Info

Installation
Download
Build Instructions

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

Source Repository
User Mail Archive
Devel Mail Archive

API Docs for SAX and DOM
 

XMLResourceIdentifier Class Reference

List of all members.

Public Types

Public Constants
enum  ResourceIdentifierType {
  SchemaGrammar = 0, SchemaImport, SchemaInclude, SchemaRedefine,
  ExternalEntity, UnKnown = 255
}

Public Member Functions

Constructors and Destructor
 XMLResourceIdentifier (const ResourceIdentifierType resourceIdentitiferType, const XMLCh *const systemId, const XMLCh *const nameSpace=0, const XMLCh *const publicId=0, const XMLCh *const baseURI=0, const Locator *locator=0)
 Constructor.
 ~XMLResourceIdentifier ()
 Destructor.
Public Methods
ResourceIdentifierType getResourceIdentifierType () const
const XMLCh * getPublicId () const
const XMLCh * getSystemId () const
const XMLCh * getSchemaLocation () const
const XMLCh * getBaseURI () const
const XMLCh * getNameSpace () const
const LocatorgetLocator () const

Detailed Description

This class is used along with XMLEntityResolver to resolve entities. Instead of passing publicId and systemId on the resolveEntity call, as is done with the SAX entity resolver, an object of type XMLResourceIdentifier is passed. By calling the getResourceIdentifierType() method the user can determine which data members are available for inspection:

ResourceIdentifierType Available Data Members
SchemaGrammar schemaLocation, nameSpace & baseURI (current document)
SchemaImport schemaLocation, nameSpace & baseURI (current document)
SchemaInclude schemaLocation & baseURI (current document)
SchemaRedefine schemaLocation & baseURI (current document)
ExternalEntity systemId, publicId & baseURI (some items may be NULL)

The following resolver would provide the application with a special character stream for the entity with the system identifier "http://www.myhost.com/today":

#include <xercesc/util/XMLEntityResolver.hpp>
#include <xercesc/sax/InputSource.hpp>

 class MyResolver : public XMLEntityResolver {
  public:
   InputSource resolveEntity (XMLResourceIdentifier* xmlri);
   ...
  };

  MyResolver::resolveEntity(XMLResourceIdentifier* xmlri) {
   switch(xmlri->getResourceIdentifierType()) {
    case XMLResourceIdentifier::SystemId:
     if (XMLString::compareString(xmlri->getSystemId(), "http://www.myhost.com/today")) {
      MyReader* reader = new MyReader();
      return new InputSource(reader);
     } else {
      return null;
     }
     break;
    default:
     return null;
   }
  }

See also:
SAXParser::setXMLEntityResolver

InputSource::InputSource


Member Enumeration Documentation

enum XMLResourceIdentifier::ResourceIdentifierType
 

Enumeration values:
SchemaGrammar 
SchemaImport 
SchemaInclude 
SchemaRedefine 
ExternalEntity 
UnKnown 


Constructor & Destructor Documentation

XMLResourceIdentifier::XMLResourceIdentifier const ResourceIdentifierType  resourceIdentitiferType,
const XMLCh *const   systemId,
const XMLCh *const   nameSpace = 0,
const XMLCh *const   publicId = 0,
const XMLCh *const   baseURI = 0,
const Locator locator = 0
 

Constructor.

XMLResourceIdentifier::~XMLResourceIdentifier  ) 
 

Destructor.


Member Function Documentation

const XMLCh * XMLResourceIdentifier::getBaseURI  )  const
 

const Locator * XMLResourceIdentifier::getLocator  )  const
 

const XMLCh * XMLResourceIdentifier::getNameSpace  )  const
 

const XMLCh * XMLResourceIdentifier::getPublicId  )  const
 

XMLResourceIdentifier::ResourceIdentifierType XMLResourceIdentifier::getResourceIdentifierType  )  const
 

const XMLCh * XMLResourceIdentifier::getSchemaLocation  )  const
 

const XMLCh * XMLResourceIdentifier::getSystemId  )  const
 


The documentation for this class was generated from the following file:


Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.