Beispiel #1
0
DOMString DOMString::substringData(unsigned int offset, unsigned int count) const
{
    unsigned int thisLen = length();
    if (offset > thisLen)
        throw DOM_DOMException(DOM_DOMException::INDEX_SIZE_ERR, 0);

    // Cap count to the string length to eliminate overflow
    //  problems when we get passed bogus values, like -1.
    if (count > thisLen)
        count = thisLen;

    // If the count extends past the end of the string, cut it
    //   back so that the returned string will stop at the end
    //   of the source string.
    if (offset + count >= thisLen)
        count = thisLen - offset;

    if (count == 0)
        return DOMString();

    // If the substring starts at the beginning of the original string
    //   we do not need to copy the data, but can set up a new
    //   string handle with the shorter length.
    if (offset == 0)
    {
        DOMString retString = this->clone();
        retString.fHandle->fLength = count;
        return retString;
    }

    // The substring starts somewhere in the interior of the orignal string.
    // Create a completely new DOMString.  No buffer sharing is possible.
    XMLCh *data = fHandle->fDSData->fData;
    return DOMString(data+offset, count);

}
int main( int argc, char ** argv )
{
	try
	{
		XMLPlatformUtils::Initialize();
	}
	catch( const XMLException& e )
	{
		cerr<< "Error during Xerces-c Initialization\n"
			<< "  Exception message:"
			<< DOMString(e.getMessage()) << endl;
		return 1;
	}

	if ( false == validateArguments(argc, argv))
	{
		usage("EXE-NAME: ");
		//exit (99);
	}

	EppParser *parser = new EppParser();

	EppXmlValidator* validator = getValidator();
	
	if (1 == argc)
	{
		validator->loadXSD(getenv("PWD"));
	}
	else if ((2 == argc) && (0 == strcmp(argv[1], ".")))
	{
		validator->loadXSD(getenv("PWD"));
	}
	else
	{
		validator->loadXSD(argv[1]);
	}


	runEppTestFee(*parser);

	delete parser;

	delete validator;
	XMLPlatformUtils::Terminate();
}
Beispiel #3
0
const DOMString &DStringPool::getPooledString(const XMLCh *in)
{
    DStringPoolEntry    **pspe;
    DStringPoolEntry    *spe;

    int    inHash     = XMLString::hash(in, fHashTableSize, fMemoryManager);
    pspe = &fHashTable[inHash];
    while (*pspe != 0)
    {
        if ((*pspe)->fString.equals(in))
            return (*pspe)->fString;
        pspe = &((*pspe)->fNext);
    }
    *pspe = spe = new (fMemoryManager) DStringPoolEntry;
    spe->fNext = 0;
    spe->fString = DOMString(in);
    return spe->fString;
};
int main( int argc, char ** argv )
{
	try
	{
		XMLPlatformUtils::Initialize();
	}
	catch( const XMLException& e )
	{
		cerr	<< "Error during Xerces-c Initialization\n"
			<< "  Exception message:"
			<< DOMString(e.getMessage()) << endl;
		return 1;
	}
	EppParser *parser = new EppParser();
	runEppTestChangePoll(*parser);

	delete 	parser;
	XMLPlatformUtils::Terminate();
}
Beispiel #5
0
DOMString EppUtil::getText( const DOMNode &root )
{
	DOMNodeList* list = root.getChildNodes();
	if( list->getLength() == 0 )
	{
		return root.getNodeValue();
	}

	DOMString str = DOMString("");
	for( unsigned int i = 0; i < list->getLength(); i++ )
	{
		DOMNode* node = list->item(i);
		if( (node->getNodeType() == DOMNode::TEXT_NODE)  || (node->getNodeType() == DOMNode::CDATA_SECTION_NODE) )
		{
			DOMString val = node->getNodeValue();
			str += val;
		}
	}
	return str;
}
Beispiel #6
0
const DOMString &DStringPool::getPooledString(const DOMString &in)
{
    DStringPoolEntry    **pspe;
    DStringPoolEntry    *spe;

    const XMLCh *inCharData = in.rawBuffer();
    int          inLength   = in.length();
    int          inHash     = XMLString::hashN(inCharData, inLength, fHashTableSize, fMemoryManager);

    pspe = &fHashTable[inHash];
    while (*pspe != 0)
    {
        if ((*pspe)->fString.equals(in))
            return (*pspe)->fString;
        pspe = &((*pspe)->fNext);
    }
    *pspe = spe = new (fMemoryManager) DStringPoolEntry;
    spe->fNext = 0;
    spe->fString = DOMString(in);
    return spe->fString;
};
Beispiel #7
0
//Introduced in DOM Level 2
ElementNSImpl::ElementNSImpl(DocumentImpl *ownerDoc,
                             const DOMString &fNamespaceURI,
                             const DOMString &qualifiedName) :
    ElementImpl(ownerDoc, qualifiedName)
{
    this->name = qualifiedName.clone();

    int index = DocumentImpl::indexofQualifiedName(qualifiedName);
    DOMString prefix;
    if (index < 0)
	throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
    if (index == 0) {	//qualifiedName contains no ':'
        prefix = null;
	this -> localName = this -> name;
    } else {	//0 < index < this->name.length()-1
	prefix = this->name.substringData(0, index);
	this -> localName =
            this->name.substringData(index+1, this->name.length()-index-1);
    }

    const DOMString& URI =
        mapPrefix(prefix, fNamespaceURI, DOM_Node::ELEMENT_NODE);
    this -> namespaceURI = URI == null ? DOMString(null) : URI.clone();
}   /* SPEC_CPU: removed extra ';' for C++98 standards compliance -- yag */
	virtual DOMString toString()
	{
		return EppEntity::toString( DOMString( "credit" ) );
	}
DOMString
EppCommandCreateLaunchRegistration::toString()
{
    return EppEntity::toString(DOMString("launch:create"));
}
DOMString CSSComputedStyleDeclarationImpl::item(unsigned long i) const
{
    if (i >= numComputedProperties)
        return DOMString();
    return getPropertyValue(computedProperties[i]);
}
	DOMString toString()
	{
		return EppEntity::toString(DOMString("transfer"));
	};
Beispiel #12
0
DOMString DOM_XMLDecl::getVersion() const
{
    return DOMString( ((XMLDeclImpl*)fImpl)->getVersion());
}
Beispiel #13
0
DOMString DOM_XMLDecl::getStandalone() const
{
    return DOMString( ((XMLDeclImpl*)fImpl)->getStandalone());
}
DOMString EppLaunchPhase::toString()
{
    return EppEntity::toString(DOMString("launch:phase"));
}
DOMString EppLaunchProtection::toString()
{
	return EppEntity::toString(DOMString((getNameSpace() + ":protection").c_str()));
}
Beispiel #16
0
	DOMString toString()
	{
		return EppEntity::toString(DOMString("reason"));
	};
DOMString EppCommandInfoLaunchRegistration::toString()
{
	return EppEntity::toString(DOMString("launch:info"));
}
	DOMString toString()
	{
		return EppEntity::toString(DOMString("check"));
	};
Beispiel #19
0
int main(int argc, char **argv)
{
  bool verbose = false;
#if 0
  DOMParser::ValSchemes    gValScheme             = DOMParser::Val_Auto;
  bool                     gDoNamespaces          = true;
  bool                     gDoSchema              = true;
  bool                     gSchemaFullChecking    = false;
  bool                     gDoCreate              = false;
#endif

  MFileOperations f;
  char path[1024];

  f.expandPath(path, "MESA_TARGET", "runtime");
  ::strcat(path, "/IHE-syslog-audit-message-4.xsd");
  char* schemaDef = path;

  int detailLevel = 1;
  MString tmp;

  while (--argc > 0 && (*++argv)[0] == '-') {
    switch (*(argv[0] + 1)) {
    case 'l':
      argc--; argv++;
      if (argc < 1)
	usage();
      tmp = *argv;
      detailLevel = tmp.intData();
      break;
    case 's':
      argc--; argv++;
      if (argc < 1)
	usage();
      schemaDef = *argv;
      break;
    case 'v':
      verbose = true;
      break;
    default:
      break;
    }
  }

  if (argc < 1)
    usage();

  // Initialize the XML4C2 system
  try {
    XMLPlatformUtils::Initialize();
  }
  catch (const XMLException& e) {
    cout << "Unable to initialize Xerces-c software"
	 << DOMString(e.getMessage()) << endl;
    return 1;
  }


  DOMParser *parser = new DOMParser;
  parser->setValidationScheme(DOMParser::Val_Auto);
  parser->setDoNamespaces(true);
  parser->setDoSchema(true);
  parser->setValidationSchemaFullChecking(true);
  if (schemaDef != "") {
    parser->setExternalNoNamespaceSchemaLocation(schemaDef);
  }

  DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
  parser->setErrorHandler(errReporter);
  parser->setCreateEntityReferenceNodes(false);
  parser->setToCreateXMLDeclTypeNode(true);

  bool errorFlag = false;

  try {
    parser->parse(*argv);
    int count = parser->getErrorCount();
    if (count > 0) {
      errorFlag = true;
      return 1;
    }
  }
  catch (const XMLException& e) {
    cout << "Parsing error: " << DOMString(e.getMessage()) << endl;
    return 1;
  }
  catch (const DOM_DOMException& e) {
   cout << "DOM Error: " << e.code << endl;
   return 1;
  }

  catch (...) {
    cout << "Unspecified error" << endl;
    return 1;
  }

  DOM_Document doc = parser->getDocument();

  unsigned int elementCount = doc.getElementsByTagName("*").getLength();

  cout << "element count: " << elementCount << endl;

  return 0;
}
DOMString CSSComputedStyleDeclarationImpl::cssText() const
{
    ERROR("unimplemented");
    return DOMString();
}
DOMString EppMarkMark::toString()
{
	std::string str = getNameSpace();
	str.append(":mark");
	return DOMString(str.c_str());
}
Beispiel #22
0
	EppWriter()
	{
		canonical = false;
		out = DOMString("");
		encoding = DOMString("UTF-8");
	};
Beispiel #23
0
DOMString NodeImpl::toString()
{
    return DOMString("[")+getNodeName()+": "+getNodeValue()+"]";
    // return getNodeName();
};
DOMString CSSStyleDeclaration::removeProperty( const DOMString &property )
{
    int id = getPropertyID(property.string().ascii(), property.length());
    if(!impl || !id) return DOMString();
    return static_cast<CSSStyleDeclarationImpl *>(impl)->removeProperty( id );
}
	DOMString toString()
	{
		return EppEntity::toString(DOMString("delete"));
	};
DOMString CSSStyleDeclaration::getPropertyValue( const DOMString &propertyName )
{
    if(!impl) return DOMString();
    CSSValue v(getPropertyCSSValue(propertyName));
    return v.cssText();
}
Beispiel #27
0
DOMString DOM_XMLDecl::getEncoding() const
{
    return DOMString( ((XMLDeclImpl*)fImpl)->getEncoding());
}
Beispiel #28
0
DOMString QualifiedName::toString() const
{
    return prefix() + DOMString(":") + localName();
}
DOMString EppResponseDataCreateLaunchRegistration::toString()
{
	return EppEntity::toString(DOMString("launch:creData"));
}
DOMString CSSComputedStyleDeclarationImpl::removeProperty(int, int &exceptionCode)
{
    exceptionCode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    return DOMString();
}