1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #include <entity.hxx> 25*b1cdbd2cSJim Jagielski 26*b1cdbd2cSJim Jagielski #include <string.h> 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielski 29*b1cdbd2cSJim Jagielski namespace DOM 30*b1cdbd2cSJim Jagielski { 31*b1cdbd2cSJim Jagielski CEntity(CDocument const & rDocument,::osl::Mutex const & rMutex,xmlEntityPtr const pEntity)32*b1cdbd2cSJim Jagielski CEntity::CEntity(CDocument const& rDocument, ::osl::Mutex const& rMutex, 33*b1cdbd2cSJim Jagielski xmlEntityPtr const pEntity) 34*b1cdbd2cSJim Jagielski : CEntity_Base(rDocument, rMutex, 35*b1cdbd2cSJim Jagielski NodeType_ENTITY_NODE, reinterpret_cast<xmlNodePtr>(pEntity)) 36*b1cdbd2cSJim Jagielski , m_aEntityPtr(pEntity) 37*b1cdbd2cSJim Jagielski { 38*b1cdbd2cSJim Jagielski } 39*b1cdbd2cSJim Jagielski IsChildTypeAllowed(NodeType const nodeType)40*b1cdbd2cSJim Jagielski bool CEntity::IsChildTypeAllowed(NodeType const nodeType) 41*b1cdbd2cSJim Jagielski { 42*b1cdbd2cSJim Jagielski switch (nodeType) { 43*b1cdbd2cSJim Jagielski case NodeType_ELEMENT_NODE: 44*b1cdbd2cSJim Jagielski case NodeType_PROCESSING_INSTRUCTION_NODE: 45*b1cdbd2cSJim Jagielski case NodeType_COMMENT_NODE: 46*b1cdbd2cSJim Jagielski case NodeType_TEXT_NODE: 47*b1cdbd2cSJim Jagielski case NodeType_CDATA_SECTION_NODE: 48*b1cdbd2cSJim Jagielski case NodeType_ENTITY_REFERENCE_NODE: 49*b1cdbd2cSJim Jagielski return true; 50*b1cdbd2cSJim Jagielski default: 51*b1cdbd2cSJim Jagielski return false; 52*b1cdbd2cSJim Jagielski } 53*b1cdbd2cSJim Jagielski } 54*b1cdbd2cSJim Jagielski 55*b1cdbd2cSJim Jagielski /** 56*b1cdbd2cSJim Jagielski For unparsed entities, the name of the notation for the entity. 57*b1cdbd2cSJim Jagielski */ getNotationName()58*b1cdbd2cSJim Jagielski OUString SAL_CALL CEntity::getNotationName() throw (RuntimeException) 59*b1cdbd2cSJim Jagielski { 60*b1cdbd2cSJim Jagielski OSL_ENSURE(false, 61*b1cdbd2cSJim Jagielski "CEntity::getNotationName: not implemented (#i113683#)"); 62*b1cdbd2cSJim Jagielski return OUString(); 63*b1cdbd2cSJim Jagielski } 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski /** 66*b1cdbd2cSJim Jagielski The public identifier associated with the entity, if specified. 67*b1cdbd2cSJim Jagielski */ getPublicId()68*b1cdbd2cSJim Jagielski OUString SAL_CALL CEntity::getPublicId() throw (RuntimeException) 69*b1cdbd2cSJim Jagielski { 70*b1cdbd2cSJim Jagielski ::osl::MutexGuard const g(m_rMutex); 71*b1cdbd2cSJim Jagielski 72*b1cdbd2cSJim Jagielski OUString aID; 73*b1cdbd2cSJim Jagielski if(m_aEntityPtr != NULL) 74*b1cdbd2cSJim Jagielski { 75*b1cdbd2cSJim Jagielski aID = OUString((sal_Char*)m_aEntityPtr->ExternalID, strlen((char*)m_aEntityPtr->ExternalID), RTL_TEXTENCODING_UTF8); 76*b1cdbd2cSJim Jagielski } 77*b1cdbd2cSJim Jagielski return aID; 78*b1cdbd2cSJim Jagielski } 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski /** 81*b1cdbd2cSJim Jagielski The system identifier associated with the entity, if specified. 82*b1cdbd2cSJim Jagielski */ getSystemId()83*b1cdbd2cSJim Jagielski OUString SAL_CALL CEntity::getSystemId() throw (RuntimeException) 84*b1cdbd2cSJim Jagielski { 85*b1cdbd2cSJim Jagielski ::osl::MutexGuard const g(m_rMutex); 86*b1cdbd2cSJim Jagielski 87*b1cdbd2cSJim Jagielski OUString aID; 88*b1cdbd2cSJim Jagielski if(m_aEntityPtr != NULL) 89*b1cdbd2cSJim Jagielski { 90*b1cdbd2cSJim Jagielski aID = OUString((sal_Char*)m_aEntityPtr->SystemID, strlen((char*)m_aEntityPtr->SystemID), RTL_TEXTENCODING_UTF8); 91*b1cdbd2cSJim Jagielski } 92*b1cdbd2cSJim Jagielski return aID; 93*b1cdbd2cSJim Jagielski } getNodeName()94*b1cdbd2cSJim Jagielski OUString SAL_CALL CEntity::getNodeName()throw (RuntimeException) 95*b1cdbd2cSJim Jagielski { 96*b1cdbd2cSJim Jagielski ::osl::MutexGuard const g(m_rMutex); 97*b1cdbd2cSJim Jagielski 98*b1cdbd2cSJim Jagielski OUString aName; 99*b1cdbd2cSJim Jagielski if (m_aNodePtr != NULL) 100*b1cdbd2cSJim Jagielski { 101*b1cdbd2cSJim Jagielski const xmlChar* xName = m_aNodePtr->name; 102*b1cdbd2cSJim Jagielski aName = OUString((sal_Char*)xName, strlen((char*)xName), RTL_TEXTENCODING_UTF8); 103*b1cdbd2cSJim Jagielski } 104*b1cdbd2cSJim Jagielski return aName; 105*b1cdbd2cSJim Jagielski } getNodeValue()106*b1cdbd2cSJim Jagielski OUString SAL_CALL CEntity::getNodeValue() throw (RuntimeException) 107*b1cdbd2cSJim Jagielski { 108*b1cdbd2cSJim Jagielski return OUString(); 109*b1cdbd2cSJim Jagielski } 110*b1cdbd2cSJim Jagielski } 111